package lesson01;

import java.io.File;
import java.io.IOException;

public class Demo0101 {
    public static void main(String[] args) throws IOException {
        System.out.println(File.pathSeparatorChar);
        System.out.println(File.separatorChar);

        File  file=new File("d:/temp");
        File file1=new File(file,"test/hello.txt");

        //绝对路径
        File file2=new File("d:\\temp\\test\\hello.txt");
        //父加子
        File file3=new File("d:/temp","test/hello.txt");
        System.out.println(file1);
        System.out.println(file2);
        System.out.println(file3);

        System.out.println(file1.getName());//获取名字
        System.out.println(file1.getPath());//获取文件路径
        System.out.println(file1.getCanonicalFile());//获取文件标准形式路径
        System.out.println(file1.getAbsoluteFile());//获取文件绝对路经
        System.out.println(file1.getParent());//获取父目录

    }
}
